<?php
/**
 * Created by JetBrains PhpStorm.
 * User: cky
 * Date: 3/17/11
 * Time: 11:54 AM
 * To change this template use File | Settings | File Templates.
 */

namespace News {

    class Controller_News extends \Controller_Base {

        public function action_index()
        {
            $total_posts = Model_Post::count();

            \Pagination::set_config(array(
                'pagination_url' => 'main/index',
                'per_page' => 5,
                'total_items' => $total_posts,
                'num_links' => 3,
            ));

            $posts = Model_Post::get_latest(\Pagination::$per_page, \Pagination::$offset)->execute();

            $this->template->title = 'Welcome';
            $this->template->total_posts = $total_posts;
            $this->template->posts = $posts;
        }

    }

}
 
